package com.xingkeduo.business.transformation.json;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xingkeduo.pojo.dto.SubscribeDTO;
import com.xingkeduo.util.pojo.base.BaseJson;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/2/19 10:32
 **/
@Component
public class JobseekerWechatJTO extends BaseJson {

    /**
     * 返回实体信息
     *
     * @param table:
     * @return : com.fasterxml.jackson.databind.node.ObjectNode
     * @author : gaozifeng
     * @date : 2019/2/19 16:24
     */
    public static ObjectNode toJson(SubscribeDTO table) throws Throwable {
        ObjectNode root = MAPPER.createObjectNode();
        if (table != null) {
            root.put("id", String.valueOf(table.getId()));
            root.put("openId", null == table.getOpenId() ? null : table.getOpenId());
            root.put("unionId", null == table.getUnionId() ? null : table.getUnionId());
            root.put("name", null == table.getNickname() ? null : table.getNickname());
            root.put("gzhOpenId", null == table.getGzhOpenId() ? null : table.getGzhOpenId());
            root.put("minaOpenId", null == table.getMinaOpenId() ? null : table.getMinaOpenId());
        }
        return root;
    }

}
